<?php
$this->breadcrumbs=array(
	'Sales' => array('sales/index'),
	'Sales Orders'
);
?>

<form name="form" method="post" action="<?php echo $this->createUrl("salesOrder/form"); ?>">
<input type="hidden" name="form_action" value="" />

<div class="clBoth"></div>
<h2 class='pt'>List of Sales Orders</h2><a href="<?php echo $this->createUrl("salesOrder/create"); ?>" class="butPrimary"><span>New Sales Order</span></a>

<div class="clBoth"></div>

<div class="action-bar">
	<div class="actions">

		<ul>
			<li><span><a href="#" onclick="return SetAction('delete')">Delete</a></span></li>
		</ul>
						
		<div class="clBoth"></div>
	</div>
</div>
<div class="index-wrapper">
<table class="index">	
	<thead>
	
		<tr>
			<td class="col-overflow-left">
				<img height="1" width="40" src="<?php Yii::app()->request->baseUrl; ?>/images/spacer.gif" alt="" />
			</td>
			<td class="col-checkbox">
				<input onClick="return Check_Uncheck(this, 'so[]')" class="checkbox"  type='checkbox' name='check'>
			</td>
			<th align="left" width='90'><a href="">SO #</a></th>
			<th align="left" width='130'><a href="">Ordered Date</a></th>
			<th align="left"><a href="">Customer</a></th>
			<th align="left" width='120'><a href="">Status</a></th>
			<th align="right" width='120'><a href="">Total</a></th>
			<td class="col-overflow-right">
				<img height="1" width="40" src="<?php Yii::app()->request->baseUrl; ?>/images/spacer.gif" alt="" />
			</td>
		</tr>
	
	</thead>

	<tbody>
		<?php foreach ($soList as $so) : ?>
			<tr>
				<td class="col-overflow-left" style="vertical-align:middle"><a class="edit _edit" href="<?php echo $this->createUrl("salesOrder/update/id/{$so->id}"); ?>" rel="6"></a></td>
				<td align='center' style="vertical-align:middle"><input class="checkbox" type='checkbox' name='so[]' value='<?php echo $so->id; ?>'></td>
				<td style="vertical-align:middle"><a href="<?php echo $this->createUrl("salesOrder/view/id/{$so->id}"); ?>"><?php echo $so->so_number; ?></a></td>
				<td style="vertical-align:middle"><?php echo $so->order_date; ?></td>
				<td align="left" style="vertical-align:middle"><?php echo $so->customer->getFormattedNameLastFirst(); ?></td>
				<td style="vertical-align:middle;"><?php echo $so->status->description; ?></td>
				<td align="right" style="vertical-align:middle">$<?php echo number_format($so->getTotalAmount(), Yii::app()->user->getState('amount_decimals')); ?></td>
				<td class="col-overflow-right"></td>
			</tr>
		<?php endforeach; ?>
	    

	</tbody>
</table>			
</div>
</form>

<div id="page">
<?php $this->widget('CLinkPager', array(
    'pages' => $pages,
)) ?>
</div>

